package com.ruoyi.system.service.impl;
import com.ruoyi.system.entity.PreventionHiddenInventoryFile;
import com.ruoyi.system.mapper.PreventionHiddenInventoryFileMapper;
import com.ruoyi.system.service.PreventionHiddenInventoryFileService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * 隐患清单_附件表(PreventionHiddenInventoryFile)表服务实现类
 * @since 2023-04-13 09:39:48
 */
@Service("preventionHiddenInventoryFileService")
public class PreventionHiddenInventoryFileServiceImpl implements PreventionHiddenInventoryFileService {
    @Resource
    private PreventionHiddenInventoryFileMapper preventionHiddenInventoryFileDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public PreventionHiddenInventoryFile queryById(Integer id) {
        return this.preventionHiddenInventoryFileDao.queryById(id);
    }

    /**
     * 分页查询
     * @return 查询结果
     */
    @Override
    public List<PreventionHiddenInventoryFile> queryByPage(PreventionHiddenInventoryFile preventionHiddenInventoryFile) {
        return this.preventionHiddenInventoryFileDao.queryAllByLimit(preventionHiddenInventoryFile);
    }

    /**
     * 新增数据
     *
     * @param preventionHiddenInventoryFile 实例对象
     * @return 实例对象
     */
    @Override
    public PreventionHiddenInventoryFile insert(PreventionHiddenInventoryFile preventionHiddenInventoryFile) {
        this.preventionHiddenInventoryFileDao.insert(preventionHiddenInventoryFile);
        return preventionHiddenInventoryFile;
    }

    /**
     * 修改数据
     *
     * @param preventionHiddenInventoryFile 实例对象
     * @return 实例对象
     */
    @Override
    public PreventionHiddenInventoryFile update(PreventionHiddenInventoryFile preventionHiddenInventoryFile) {
        this.preventionHiddenInventoryFileDao.update(preventionHiddenInventoryFile);
        return this.queryById(preventionHiddenInventoryFile.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.preventionHiddenInventoryFileDao.deleteById(id) > 0;
    }
}
